package com.revenco.bi.dao.nutz;

import java.util.List;

import org.nutz.dao.Cnd;
import org.nutz.dao.Condition;
import org.springframework.stereotype.Repository;

import com.revenco.bi.dao.ViewEditChartDao;
import com.revenco.bi.model.TnChartBaseinfo;
import com.revenco.bi.model.TnChartDataitems;
import com.revenco.bi.model.TnChartParams;

/**
 * 预览编辑图表
 * @author zhaozz
 *
 */
@Repository
public class ViewEditChartDaoImpl extends AstractDaoImpl implements ViewEditChartDao {
	/**
	 * 获取图标基本信息表
	 * @param chartId
	 * @return
	 */
	public TnChartBaseinfo getChartInfo(String chartId) {
		try{
			TnChartBaseinfo tcb=new TnChartBaseinfo();
			Condition condition = Cnd.where("chartId", "=", chartId);
			tcb=this.getDao().fetch(TnChartBaseinfo.class, condition);
			return tcb;
		}catch(Exception e){
			
			return null;
		}
		
	}

	/**
	 * 获取数据项配置表集合
	 * @param chartId
	 * @return
	 */
	public List<TnChartDataitems> getChartDatas(String chartId) {
		try{
			
			Condition condition = Cnd.where("chartId", "=", chartId);
			return this.getDao().query(TnChartDataitems.class, condition);
			 
		}catch(Exception e){
			
			return null;
		}
	}
	/**
	 * 图表参数表集合
	 * @param chartId
	 * @return
	 */
	public List<TnChartParams> getChartParams(String chartId) {
        try{
			Condition condition = Cnd.where("chartId", "=", chartId);
			return this.getDao().query(TnChartParams.class, condition);
			 
		}catch(Exception e){
			
			return null;
		 }
	}

	public List<?> getChartDetail(Class<?> t, String id) {
		Condition condition = Cnd.where("chartId", "=", id);
		return this.getDao().query(t, condition);
	}
}
